package hu.u_szeged.inf.ovrt.ioc_demo.dao;

import hu.u_szeged.inf.ovrt.ioc_demo.beans.User;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SimpleUserDAO implements UserDAO {
    Map<String, User> users;
    
    public SimpleUserDAO() {
        this.users = new HashMap<String, User>();
        users.put("1", new User("kapal", "Ka Pál"));
        users.put("2", new User("aron", "Akciós Áron"));
        users.put("3", new User("odon", "Zsíros B. Ödön"));
    }

    @Override
    public List<User> getUsers() {
        return new ArrayList<User>(users.values());
    }

    @Override
    public User getUserByID(String userID) {
        User user=null;
        
        if(users.containsKey(userID))
        {
            user = users.get(userID);
        }
        
        return user;
    }
}
